define(['text!evaluate/gift.html'],
	function(viewTemplate) {
		return Piece.View.extend({
			id: 'evaluate_gift',
			events: {
				"click #complete": "complete",
				"click .giftBackground":"choose_gift"
			},
			render: function() {
				$(this.el).html(viewTemplate);

				Piece.View.prototype.render.call(this);
                window.scrollTo(0,0);
				return this;
			},
			onShow: function() {
				//write your business logic here :)
			},
			complete:function(){
				alert("感谢您的参与")
				this.container.navigateForResult('/login/menu', {
					trigger: true
				}, 'evaluate/gift', this.onGotResult);
			},
            choose_gift:function(el){
                var $target= $(el.currentTarget);
                console.debug("$target="+$target);
                console.debug("$target index="+($target.parent()).index());
                var items = $target.parent().children();
//                /$(items).
//                $(items).gift-select
                $(".gift-select").hide();
//                $(items).gift-select
                $('.gift-select', $target).show();

                for (var i=0;i<items.length;i++){
//                    $(items[i])

                }

			}
		}); //view define

	});